package com.maopuyu.utils;


import com.thoughtworks.xstream.XStream;

public class XMLBuilder {
    private static final XStream xStream = XStreamFactory.getXStream();

    public static String beanToXml(Object object) {
        xStream.alias("xml", object.getClass());
        xStream.processAnnotations(object.getClass());
        String xml = xStream.toXML(object);
        if (!StringUtils.isEmpty(xml)) {
            return xml;
        } else {
            return null;
        }
    }
}
